

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Welcome to easylogger’s documentation! &mdash; easylogger v0.1 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="easylogger v0.1 documentation" href="#" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="#">easylogger v0.1 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="welcome-to-easylogger-s-documentation">
<h1>Welcome to easylogger&#8217;s documentation!<a class="headerlink" href="#welcome-to-easylogger-s-documentation" title="Permalink to this headline">¶</a></h1>
<div class="section" id="summary">
<h2>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
<p><strong>Easylogger</strong> is a Python package which wraps aspects of original <a class="reference external" href="http://docs.python.org/library/logging.html#module-logging" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">logging</span></tt></a>
module in simple and Pythonic way. You can use all power of the original package
with the new facilities side-by-side.</p>
<p>The key features of current version of <strong>easylogging</strong> package are:</p>
<ul class="simple">
<li>Easy to start logging without configuring anything;</li>
<li>Provided decorator-mode to log every function or method call and its doc-string;</li>
<li>Imitate and replace stdout and stderr streams in order to redirect <a class="reference external" href="http://docs.python.org/library/functions.html#print" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">print()</span></tt></a> messages to required logging handlers;</li>
<li>Alternative message formatting system (like <a class="reference external" href="http://docs.python.org/library/functions.html#print" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">print()</span></tt></a> does);</li>
<li>And more! See unit-tests for additional code examples;</li>
</ul>
<p>See examples below for the features description.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Python version <strong>2.6</strong> or higher is required to use easylogger package.</p>
</div>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
<div class="topic">
<p class="topic-title first">1. Easy start to use logging facilities:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">easylogger</span> <span class="kn">import</span> <span class="n">log</span><span class="p">,</span> <span class="n">info</span><span class="p">,</span> <span class="n">debug</span><span class="p">,</span> <span class="n">DEBUG</span>
<span class="n">log</span><span class="p">(</span><span class="s">&quot;Hello, World!&quot;</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;This is an information message&quot;</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&quot;This is a debug message&quot;</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;This is an error message&quot;</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">critical</span><span class="p">(</span><span class="s">&quot;This is an critical message&quot;</span><span class="p">)</span>
<span class="n">info</span><span class="p">(</span><span class="s">&quot;Hello!&quot;</span><span class="p">)</span>
<span class="n">debug</span><span class="p">(</span><span class="s">&quot;Bye&quot;</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">log</span><span class="p">(</span><span class="n">DEBUG</span><span class="p">,</span> <span class="s">&quot;Generic log method.&quot;</span><span class="p">)</span>
</pre></div>
</div>
<div class="highlight-python"><pre>... [DEBUG   ] Hello, World!
... [INFO    ] This is an information message
... [DEBUG   ] This is a debug message
... [ERROR   ] This is an error message
... [CRITICAL] This is an critical message
... [INFO    ] Hello!
... [DEBUG   ] Bye!
... [DEBUG   ] Generic log method.</pre>
</div>
</div>
<div class="topic">
<p class="topic-title first">2. Using logger as decorator:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="nd">@log</span>
<span class="k">def</span> <span class="nf">create_human</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">sex</span><span class="p">,</span> <span class="n">age</span><span class="o">=</span><span class="mi">26</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;Create new human with name &#39;{name}&#39; and age {age}.&quot;&quot;&quot;</span>
    <span class="k">print</span> <span class="s">&quot;Creating new human &#39;{0}-{1}-{2}&#39;.&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">sex</span><span class="p">,</span> <span class="n">age</span><span class="p">)</span>

<span class="k">class</span> <span class="nc">MyExClass</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>

    <span class="nd">@info</span>
    <span class="k">def</span> <span class="nf">print_hi</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">who</span><span class="p">):</span>
        <span class="k">print</span> <span class="s">&quot;Who?&quot;</span><span class="p">,</span> <span class="n">who</span>

<span class="n">log</span><span class="p">(</span><span class="s">&quot;Checking decorator-mode.&quot;</span><span class="p">)</span>
<span class="n">create_human</span><span class="p">(</span><span class="s">&quot;Ivan&quot;</span><span class="p">,</span> <span class="s">&quot;male&quot;</span><span class="p">)</span>
<span class="n">MyExClass</span><span class="p">()</span><span class="o">.</span><span class="n">print_hi</span><span class="p">(</span><span class="s">&quot;me&quot;</span><span class="p">)</span>
</pre></div>
</div>
<div class="highlight-python"><pre>... [DEBUG   ] Checking decorator-mode.
... [DEBUG   ] Executing function create_human(name='Ivan', sex='male', age=26).
... [DOC     ] Create new human with name 'Ivan' and age 26.
Creating new human 'Ivan-male-26'.
... [INFO    ] Executing method MyExClass.print_hi(who='me').
Who? me</pre>
</div>
</div>
<div class="topic">
<p class="topic-title first">3. Imitate and replace <cite>stdout</cite> and <cite>stderr</cite> streams:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">from</span> <span class="nn">easylogger</span> <span class="kn">import</span> <span class="n">log</span><span class="p">,</span> <span class="n">STDOUT</span><span class="p">,</span> <span class="n">STDERR</span>

<span class="c"># replace current streams</span>
<span class="n">sys</span><span class="o">.</span><span class="n">stdout</span> <span class="o">=</span> <span class="n">log</span><span class="o">.</span><span class="n">get_stream</span><span class="p">(</span><span class="n">STDOUT</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">stderr</span> <span class="o">=</span> <span class="n">log</span><span class="o">.</span><span class="n">get_stream</span><span class="p">(</span><span class="n">STDERR</span><span class="p">)</span>

<span class="k">print</span> <span class="s">&quot;Hello,&quot;</span><span class="p">,</span> <span class="s">&quot;World!&quot;</span>
<span class="k">print</span> <span class="o">&gt;&gt;</span> <span class="n">sys</span><span class="o">.</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Error message!&quot;</span>

<span class="c"># assign original stream values</span>
<span class="n">sys</span><span class="o">.</span><span class="n">stdout</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">__stdout__</span>
<span class="n">sys</span><span class="o">.</span><span class="n">stderr</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">__stderr__</span>
</pre></div>
</div>
<div class="highlight-python"><pre>... [STDOUT  ] Hello, World!
... [STDERR  ] Error message!</pre>
</div>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Keep in mind that if you provide <tt class="xref py py-class docutils literal"><span class="pre">sys.stdout</span></tt>  (<tt class="xref py py-class docutils literal"><span class="pre">sys.stderr</span></tt>)
as stream parameter to <a class="reference external" href="http://docs.python.org/library/logging.handlers.html#logging.StreamHandler" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">logging.StreamHandler</span></tt></a> you may get into recursive loop when
using stream redirection. Always provide <tt class="xref py py-class docutils literal"><span class="pre">sys.__stdout__</span></tt> (<tt class="xref py py-class docutils literal"><span class="pre">sys.__stderr__</span></tt>)
when constructing a stream handler to avoid this problem.</p>
</div>
</div>
<div class="topic">
<p class="topic-title first">4. Alternative message formatting system:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">easylogger</span> <span class="kn">import</span> <span class="n">log</span><span class="p">,</span> <span class="n">error</span><span class="p">,</span> <span class="n">info</span><span class="p">,</span> <span class="n">LoggingOptions</span>

<span class="c"># new message style</span>
<span class="n">log</span><span class="p">(</span><span class="s">&quot;Hello, World!&quot;</span><span class="p">,</span> <span class="s">&quot;test1&quot;</span><span class="p">,</span> <span class="s">&quot;test2&quot;</span><span class="p">)</span>
<span class="n">component</span> <span class="o">=</span> <span class="s">&quot;brain&quot;</span>
<span class="n">error</span><span class="p">(</span><span class="s">&quot;Error occurred in&quot;</span><span class="p">,</span> <span class="n">component</span><span class="p">,</span> <span class="s">&quot;with code&quot;</span><span class="p">,</span> <span class="mi">123</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">set_options</span><span class="p">(</span><span class="n">new_style_delimiter</span><span class="o">=</span><span class="s">&quot;_&quot;</span><span class="p">)</span>
<span class="n">log</span><span class="p">(</span><span class="s">&quot;brown&quot;</span><span class="p">,</span> <span class="s">&quot;fox&quot;</span><span class="p">,</span> <span class="s">&quot;jumps&quot;</span><span class="p">,</span> <span class="s">&quot;over&quot;</span><span class="p">,</span> <span class="s">&quot;lazy&quot;</span><span class="p">,</span> <span class="s">&quot;dog&quot;</span><span class="p">)</span>

<span class="c"># old message style</span>
<span class="n">opt</span> <span class="o">=</span> <span class="n">LoggingOptions</span><span class="p">()</span>
<span class="n">opt</span><span class="o">.</span><span class="n">enable_new_style</span> <span class="o">=</span> <span class="bp">False</span>
<span class="n">log</span><span class="o">.</span><span class="n">set_options</span><span class="p">(</span><span class="n">opt</span><span class="p">)</span>
<span class="n">info</span><span class="p">(</span><span class="s">&quot;a </span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="s">&quot;b&quot;</span><span class="p">,</span> <span class="s">&quot;c&quot;</span><span class="p">)</span>
</pre></div>
</div>
<div class="highlight-python"><pre>... [DEBUG   ] Hello, World! test1 test2
... [ERROR   ] Error occurred in brain with code 123 &lt;type 'int'&gt;
... [DEBUG   ] brown_fox_jumps_over_lazy_dog
... [INFO    ] a b c</pre>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">For more options see <a class="reference internal" href="#easylogger.LoggingOptions" title="easylogger.LoggingOptions"><tt class="xref py py-class docutils literal"><span class="pre">easylogger.LoggingOptions</span></tt></a>.</p>
</div>
</div>
<div class="topic">
<p class="topic-title first">5. Using original logging features and new ones side-by-side:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">easylogger</span> <span class="kn">import</span> <span class="n">get_logger</span><span class="p">,</span> <span class="n">INFO</span>
<span class="kn">import</span> <span class="nn">logging.config</span>

<span class="n">logging</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">fileConfig</span><span class="p">(</span><span class="s">&quot;logging.cfg&quot;</span><span class="p">)</span>
<span class="n">mylog</span> <span class="o">=</span> <span class="n">get_logger</span><span class="p">(</span><span class="s">&quot;simpleExample&quot;</span><span class="p">,</span> <span class="n">level</span><span class="o">=</span><span class="n">INFO</span><span class="p">)</span>
<span class="n">mylog</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Hello!&quot;</span><span class="p">)</span>
<span class="n">mylog</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&quot;Hello!&quot;</span><span class="p">)</span>
<span class="n">mylog</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;Hello!&quot;</span><span class="p">)</span>
</pre></div>
</div>
<div class="highlight-python"><pre>simpleExample - INFO - Hello!
simpleExample - ERROR - Hello!</pre>
</div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">A lot of examples can be found in <tt class="file docutils literal"><span class="pre">/tests/basic_tests.py</span></tt> file.</p>
</div>
</div>
<div class="section" id="module-easylogger">
<span id="easylogger-objects"></span><h2>Easylogger objects<a class="headerlink" href="#module-easylogger" title="Permalink to this headline">¶</a></h2>
<p><strong>Easylogger</strong> is a wrapper for standard <a class="reference external" href="http://docs.python.org/library/logging.html#module-logging" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">logging</span></tt></a> module, which provides some new
logging facilities and allows accessing them in more Pythonic way.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">copyright:</th><td class="field-body">Copyright 2011 by Oleg Churkin &lt;<a class="reference external" href="mailto:bahusoff&#37;&#52;&#48;gmail&#46;com">bahusoff<span>&#64;</span>gmail<span>&#46;</span>com</a>&gt;.</td>
</tr>
<tr class="field"><th class="field-name">license:</th><td class="field-body">BSD, see LICENSE.txt for details.</td>
</tr>
</tbody>
</table>
<dl class="function">
<dt id="easylogger.info">
<tt class="descclassname">easylogger.</tt><tt class="descname">info</tt><big>(</big><em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.info" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message with severity <tt class="docutils literal"><span class="pre">INFO</span></tt> on the root logger.</p>
</dd></dl>

<dl class="function">
<dt id="easylogger.debug">
<tt class="descclassname">easylogger.</tt><tt class="descname">debug</tt><big>(</big><em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#debug"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message with severity <tt class="docutils literal"><span class="pre">DEBUG</span></tt> on the root logger.</p>
</dd></dl>

<dl class="function">
<dt id="easylogger.error">
<tt class="descclassname">easylogger.</tt><tt class="descname">error</tt><big>(</big><em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#error"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.error" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message with severity <tt class="docutils literal"><span class="pre">ERROR</span></tt> on the root logger.</p>
</dd></dl>

<dl class="function">
<dt id="easylogger.warning">
<tt class="descclassname">easylogger.</tt><tt class="descname">warning</tt><big>(</big><em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#warning"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.warning" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message with severity <tt class="docutils literal"><span class="pre">WARNING</span></tt> on the root logger.</p>
</dd></dl>

<dl class="function">
<dt id="easylogger.warn">
<tt class="descclassname">easylogger.</tt><tt class="descname">warn</tt><big>(</big><em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#easylogger.warn" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message with severity <tt class="docutils literal"><span class="pre">WARNING</span></tt> on the root logger.</p>
</dd></dl>

<dl class="function">
<dt id="easylogger.exception">
<tt class="descclassname">easylogger.</tt><tt class="descname">exception</tt><big>(</big><em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#exception"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.exception" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message with severity <tt class="docutils literal"><span class="pre">ERROR</span></tt> on the root logger.</p>
</dd></dl>

<dl class="function">
<dt id="easylogger.critical">
<tt class="descclassname">easylogger.</tt><tt class="descname">critical</tt><big>(</big><em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#critical"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.critical" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message with severity <tt class="docutils literal"><span class="pre">CRITICAL</span></tt> on the root logger.</p>
</dd></dl>

<dl class="function">
<dt id="easylogger.compose_handler">
<tt class="descclassname">easylogger.</tt><tt class="descname">compose_handler</tt><big>(</big><em>handler</em>, <em>level=None</em>, <em>format_tuple=None</em>, <em>filter_name=None</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#compose_handler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.compose_handler" title="Permalink to this definition">¶</a></dt>
<dd><p>Help to compose final handler.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>handler</strong> &#8211; any handler object from logging and logging.handlers;</li>
<li><strong>level</strong> &#8211; logging level (<tt class="docutils literal"><span class="pre">INFO</span></tt>, <tt class="docutils literal"><span class="pre">DEBUG</span></tt> and so on);</li>
<li><strong>format_tuple</strong> &#8211; message format tuple (fmt, datefmt), see <a class="reference external" href="http://docs.python.org/library/logging.html#logging.Formatter" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">logging.Formatter</span></tt></a>.
Only if string is provided, <tt class="docutils literal"><span class="pre">datefmt</span></tt> will be passed as None;</li>
<li><strong>filter_name</strong> &#8211; filter name, see <a class="reference external" href="http://docs.python.org/library/logging.html#logging.Filter" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">logging.Filter</span></tt></a>;</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="easylogger.get_logger">
<tt class="descclassname">easylogger.</tt><tt class="descname">get_logger</tt><big>(</big><em>name=None</em>, <em>level=None</em>, <em>handlers=None</em>, <em>options=None</em>, <em>extra=None</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#get_logger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.get_logger" title="Permalink to this definition">¶</a></dt>
<dd><p>Return basic logger object.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>name</strong> &#8211; logger&#8217;s name;</li>
<li><strong>level</strong> &#8211; logging level, if not specified and some handlers are provided,
minimum of all their levels will be taken. If final value is <tt class="docutils literal"><span class="pre">NOTSET</span></tt>,
then <tt class="xref py py-const docutils literal"><span class="pre">Defaults.GLOBAL_LOGGING_LEVEL</span></tt> will be used;</li>
<li><strong>handlers</strong> &#8211; list of handlers for created logger to attach,
if value is not iterable, it will be put in
a list automatically;</li>
<li><strong>options</strong> &#8211; <a class="reference internal" href="#easylogger.LoggingOptions" title="easylogger.LoggingOptions"><tt class="xref py py-class docutils literal"><span class="pre">LoggingOptions</span></tt></a> object;</li>
<li><strong>extra</strong> &#8211; extra arguments for underlying logging functionality, see 
documentation for <a class="reference external" href="http://docs.python.org/library/logging.html#module-logging" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">logging</span></tt></a>;</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="easylogger.get_default_logger">
<tt class="descclassname">easylogger.</tt><tt class="descname">get_default_logger</tt><big>(</big><em>stream=None</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#get_default_logger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.get_default_logger" title="Permalink to this definition">¶</a></dt>
<dd><p>Return default logger for this module.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><strong>stream</strong> &#8211; stream object for default logging handler <a class="reference external" href="http://docs.python.org/library/logging.handlers.html#logging.StreamHandler" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">logging.StreamHandler</span></tt></a>,
default value is <tt class="docutils literal"><span class="pre">sys.__stdout__</span></tt>.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="easylogger.LoggingOptions">
<em class="property">class </em><tt class="descclassname">easylogger.</tt><tt class="descname">LoggingOptions</tt><a class="reference internal" href="_modules/easylogger.html#LoggingOptions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggingOptions" title="Permalink to this definition">¶</a></dt>
<dd><p>This structure contains different logging options.</p>
<dl class="docutils">
<dt>Available options:</dt>
<dd><ul class="first last">
<li><dl class="first docutils">
<dt><strong>indent_size</strong> - specifies number of spaces to be inserted before</dt>
<dd><p class="first last">&#8216;%(message)s&#8217; parameter, see logging.Formatter for more details;</p>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt><strong>enable_new_style</strong> - if <tt class="xref docutils literal"><span class="pre">True</span></tt> log&#8217;s methods will join all provided</dt>
<dd><dl class="first last docutils">
<dt>positional arguments with space as delimiter, e.g.:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;I&quot;</span><span class="p">,</span> <span class="s">&quot;am&quot;</span><span class="p">,</span> <span class="s">&quot;fine.&quot;</span><span class="p">)</span>
<span class="go">I am fine.</span>
</pre></div>
</div>
</dd>
</dl>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt><strong>new_style_delimiter</strong> - delimiter between message parts when new</dt>
<dd><p class="first last">message style is enabled, space by default;</p>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt><strong>enable_decorator_mode</strong> - if <tt class="xref docutils literal"><span class="pre">True</span></tt> log&#8217;s methods will produce necessary</dt>
<dd><p class="first last">messages when used as decorators, otherwise no output will be produced;</p>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt><strong>enable_doc_processing</strong> - if <tt class="xref docutils literal"><span class="pre">True</span></tt> all doc strings will be logged by log</dt>
<dd><p class="first last">or its method used as decorators;</p>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt><strong>doc_processing_prefix</strong> - if specified, only doc strings begins with</dt>
<dd><p class="first last">this character(s) will be logged. Character(s) will be stripped
from logged message;</p>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt><strong>doc_processing_level</strong> - logging level for logged doc strings, by default</dt>
<dd><p class="first last">it&#8217;s <tt class="xref py py-const docutils literal"><span class="pre">DOC</span></tt>;</p>
</dd>
</dl>
</li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="class">
<dt id="easylogger.LoggerAdapter">
<em class="property">class </em><tt class="descclassname">easylogger.</tt><tt class="descname">LoggerAdapter</tt><big>(</big><em>logger=None</em>, <em>options=None</em>, <em>extra=None</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter" title="Permalink to this definition">¶</a></dt>
<dd><p>An adapter for loggers which makes it easier to specify contextual
information in logging output.</p>
<dl class="method">
<dt id="easylogger.LoggerAdapter.append_handlers">
<tt class="descname">append_handlers</tt><big>(</big><em>*handlers</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.append_handlers"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.append_handlers" title="Permalink to this definition">¶</a></dt>
<dd><p>Append provided handlers to the list of existed ones.</p>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.critical">
<tt class="descname">critical</tt><big>(</big><em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.critical"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.critical" title="Permalink to this definition">¶</a></dt>
<dd><p>Delegate a critical call to the underlying logger, after adding
contextual information from this adapter instance.</p>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.debug">
<tt class="descname">debug</tt><big>(</big><em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.debug"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Delegate a debug call to the underlying logger, after adding
contextual information from this adapter instance.</p>
</dd></dl>

<dl class="attribute">
<dt id="easylogger.LoggerAdapter.effective_level">
<tt class="descname">effective_level</tt><a class="headerlink" href="#easylogger.LoggerAdapter.effective_level" title="Permalink to this definition">¶</a></dt>
<dd><p>Return effective logging level, any message produced with this level
will be logged by all attached handlers.</p>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.error">
<tt class="descname">error</tt><big>(</big><em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.error"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.error" title="Permalink to this definition">¶</a></dt>
<dd><p>Delegate an error call to the underlying logger, after adding
contextual information from this adapter instance.</p>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.exception">
<tt class="descname">exception</tt><big>(</big><em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.exception"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.exception" title="Permalink to this definition">¶</a></dt>
<dd><p>Delegate an exception call to the underlying logger, after adding
contextual information from this adapter instance.</p>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.get_effective_level">
<tt class="descname">get_effective_level</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.get_effective_level"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.get_effective_level" title="Permalink to this definition">¶</a></dt>
<dd><p>Return effective logging level, any message produced with this level
will be logged by all attached handlers.</p>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.get_level">
<tt class="descname">get_level</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.get_level"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.get_level" title="Permalink to this definition">¶</a></dt>
<dd><p>Return current logger&#8217;s level.</p>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.get_stream">
<tt class="descname">get_stream</tt><big>(</big><em>level=None</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.get_stream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.get_stream" title="Permalink to this definition">¶</a></dt>
<dd><p>Return stream imitation object, which can replace stdout and
stderr streams.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><strong>level</strong> &#8211; logging level, messages will be logged with,
usually <tt class="xref py py-const docutils literal"><span class="pre">STDOUT</span></tt> or <tt class="xref py py-const docutils literal"><span class="pre">STDERR</span></tt>;</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.info">
<tt class="descname">info</tt><big>(</big><em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.info" title="Permalink to this definition">¶</a></dt>
<dd><p>Delegate an info call to the underlying logger, after adding
contextual information from this adapter instance.</p>
</dd></dl>

<dl class="attribute">
<dt id="easylogger.LoggerAdapter.level">
<tt class="descname">level</tt><a class="headerlink" href="#easylogger.LoggerAdapter.level" title="Permalink to this definition">¶</a></dt>
<dd><p>Return current logger&#8217;s level.</p>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.log">
<tt class="descname">log</tt><big>(</big><em>level</em>, <em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.log"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.log" title="Permalink to this definition">¶</a></dt>
<dd><p>Delegate a log call to the underlying logger, after adding
contextual information from this adapter instance.</p>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.process_message">
<tt class="descname">process_message</tt><big>(</big><em>msg</em>, <em>args</em>, <em>kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.process_message"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.process_message" title="Permalink to this definition">¶</a></dt>
<dd><p>Process the logging message and keyword arguments passed in to
a logging call to insert contextual information. You can either
manipulate the message itself, args or keyword args. Return
the message, args and kwargs modified (or not) to suit your needs.</p>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.replace_handlers">
<tt class="descname">replace_handlers</tt><big>(</big><em>*handlers</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.replace_handlers"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.replace_handlers" title="Permalink to this definition">¶</a></dt>
<dd><p>Replace current list of handlers with the provided ones.</p>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.set_effective_level">
<tt class="descname">set_effective_level</tt><big>(</big><em>level</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.set_effective_level"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.set_effective_level" title="Permalink to this definition">¶</a></dt>
<dd><p>Set effective level: set the same logging level for current logger
and for all its handlers.</p>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.set_level">
<tt class="descname">set_level</tt><big>(</big><em>level</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.set_level"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.set_level" title="Permalink to this definition">¶</a></dt>
<dd><p>Set logging level for current logger only.</p>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.set_options">
<tt class="descname">set_options</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.set_options"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.set_options" title="Permalink to this definition">¶</a></dt>
<dd><p>Set logging options, see <a class="reference internal" href="#easylogger.LoggingOptions" title="easylogger.LoggingOptions"><tt class="xref py py-class docutils literal"><span class="pre">LoggingOptions</span></tt></a> class above.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>args</strong> &#8211; here can be only one positional argument: instance of
LoggingOptions object, if it&#8217;s provided, keyword arguments will
be ignored and current logging options will be replaced with
provided ones;</li>
<li><strong>kwargs</strong> &#8211; any existing options can be provided (see available in
<a class="reference internal" href="#easylogger.LoggingOptions" title="easylogger.LoggingOptions"><tt class="xref py py-class docutils literal"><span class="pre">LoggingOptions</span></tt></a> class);</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="easylogger.LoggerAdapter.warning">
<tt class="descname">warning</tt><big>(</big><em>msg</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/easylogger.html#LoggerAdapter.warning"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#easylogger.LoggerAdapter.warning" title="Permalink to this definition">¶</a></dt>
<dd><p>Delegate a warning call to the underlying logger, after adding
contextual information from this adapter instance.</p>
</dd></dl>

</dd></dl>

</div>
</div>
<div class="section" id="indices-and-tables">
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1>
<ul class="simple">
<li><a class="reference internal" href="genindex.html"><em>Index</em></a></li>
<li><a class="reference internal" href="py-modindex.html"><em>Module Index</em></a></li>
<li><a class="reference internal" href="search.html"><em>Search Page</em></a></li>
</ul>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="#">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Welcome to easylogger&#8217;s documentation!</a><ul>
<li><a class="reference internal" href="#summary">Summary</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
<li><a class="reference internal" href="#module-easylogger">Easylogger objects</a></li>
</ul>
</li>
<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
</ul>

  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/index.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="#">easylogger v0.1 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2011, Oleg Churkin.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>